﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<link rel="Bookmark" href="imgs/favicon.ico"/>
	<link rel="Shortcut Icon" href="imgs/favicon.ico"/>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<link href="static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css"/>
	<link href="static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css"/>
	<title>得然后台登录</title>
	<style type="text/css">
		#header { margin: 0 auto; margin-top: 10%; width: 500px;
			text-align: center; color: #333; font-size: 30px; font-weight: bolder; }
		.loginWraper { margin: 0 auto; width: 600px; }
	</style>
</head>
<body>
	<div id="header">
		<h4>得然版权</h4>
		后台管理系统
	</div>
	<div class="loginWraper">
		<div id="loginform" class="loginBox">
			<form class="form form-horizontal" action="index.html" method="post">
				<div class="row cl">
					<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
					<div class="formControls col-xs-8">
						<input type="text" placeholder="输入账户" class="input-text size-L" id="uname" value="admin"/>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
					<div class="formControls col-xs-8">
						<input type="password" placeholder="输入密码" class="input-text size-L" id="upwd" value="123456"/>
					</div>
				</div>
				<div class="row cl">
					<div class="formControls col-xs-8 col-xs-offset-3">
						<input class="btn btn-success radius size-L" value=" &nbsp; 登 &nbsp; &nbsp; 录 &nbsp; " onclick="dologin();"/>
					</div>
				</div>
			</form>
		</div>
	</div>

	<!--自定义弹窗-->
	<span id="msgPop"></span>
</body>
</html>


<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/view.js"></script>
<script type="text/javascript">
	(function() {
	})();
	//登录
	function dologin(){
		var formData = {
			uname: $('#uname').val(),
			upwd: $('#upwd').val()
		};
		if (formData.uname == '') {
			msgPop({msg: '账号名必须的'});
			//layerMsgErr('账号名必须的！');
			return
		}
		if (formData.upwd == '') {
			msgPop({msg: '密码必须的'});
			//layerMsgErr('密码必须的！');
			return
		}
		console.log(formData);
		$.ajax({
			type: apis.login.method,
			url: apis.login.url,
			data: formData,
			success: function (res) {
				console.log(res);
				if (res.code < 0) {
					//layerMsgErr(res.msg); return
					msgPop({msg: res.msg}); return
				}
				//layerMsgOk('登录成功');
				msgPop({msg: '登录成功'});
				var adminInfo = {
					adminid: res.data.adminid,
					adminName: res.data.adminName,
				};
				setAdminInfo({val: adminInfo});
				setTimeout(function () {
					window.location.href = 'index.html';
				}, 1000);
			},
			error: function () {
				console.log('错误了！');
			}
		});
	}
</script>